package com.cmo.common.controller.qingmujiayanglaozhongxin;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.cmo.common.model.PatientQueue;
import com.cmo.common.utils.Shared;
import com.cmo.common.utils.ToolString;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Record;

public class QmjylzxController extends Controller {
	
	PatientQueue patientqueue=new PatientQueue();
	Shared shared=new Shared();
	
	public void list_content_patient(){
		Map<String, Object> map=new HashMap<String, Object>();
 		List<Record> list=patientqueue.list_content_patient(shared.getIpAddr(getRequest()));
		if(list.size()<0){
			map.put("return_code", "fail");
			map.put("return_msg", "查询失败");
			renderJson(map);
			return;
		}else{
			map.put("return_code", "success");
			map.put("return_msg", "查询成功");
			map.put("count", list.size());
			map.put("list", list);
			patientqueue.update_istype();
			renderJson(map);
		}
		
		renderJson(map);
	}
	
	public void update_content(){
		Map<String, Object> map=new HashMap<String, Object>();
		String queue_type_id=getPara("queue_type_id");
		if(ToolString.isBlank(queue_type_id)){
			map.put("return_code", "fail");
			map.put("return_msg", "不能为空值");
			renderJson(map);
			return;
		}
		String id =getPara("id");
		if(ToolString.isBlank(id)){
			map.put("return_code", "fail");
			map.put("return_msg", "不能为空值");
			renderJson(map);
			return;
		}
		int update_content= patientqueue.update_content(Integer.parseInt(queue_type_id), Integer.parseInt(id),shared.getIpAddr(getRequest()));
		if(update_content<0){
			map.put("return_code", "fail");
			map.put("return_msg", "更改失败");
			renderJson(map);
			return;
		}else{
			map.put("return_code", "success");
			map.put("return_msg", "更改成功");
			renderJson(map);
		}
		renderJson(map);
	}
}
